package com.ffdms.db;

import com.ffdms.vo.Message;
import com.ffdms.vo.Notice;
import com.ffdms.vo.PlanInfo;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DbHelper extends SQLiteOpenHelper {
	private static final String TAG = "DbHelper";
	public static final String DATABASE_NAME = "com.ffdms.mobileoffice";
	public static final int DATABASE_VESION = 1;
	
	public DbHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VESION);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(Message.CREATE_TABLE_SQL);
		db.execSQL(Notice.CREATE_TABLE_SQL);
	    db.execSQL(PlanInfo.CREATE_TABLE_SQL);
	}
	
	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
//		String sql="drop table if exits user";
//		db.execSQL(sql);
//		this.onCreate(db);
	}
	
	@Override
	public synchronized void close() {
		// TODO Auto-generated method stub
		super.close();
		Log.d(TAG,"database closed");
	}

	@Override
	public void onOpen(SQLiteDatabase db) {
		super.onOpen(db);
		Log.d(TAG,"database open");
	}

}

